package com.authine.cloudpivot.ext.enums.kingdee;

/**
 * @Author: 李国祥
 * @Date: 2019/11/19 15:05
 * @Version 1.0
 */
public enum KingDeeTradeTypeEnum {

    ALL(0, "全部"),
    SALE(1, "销售"),
    PURCHASE(2, "采购"),
    SALE_SUPPLEMENTARY(3, "销售增补"),
    PURCHASE_SUPPLEMENTARY(4, "采购增补"),
    SALE_REFUND(5, "销售退款"),
    PURCHASE_REFUND(6, "采购退款"),
    SALE_SUPPLEMENTARY_REFUND(7, "销售增补退款"),
    PURCHASE_SUPPLEMENTARY_REFUND(8, "采购增补退款"),

    ;

    public Integer id;
    public String text;

    private KingDeeTradeTypeEnum(Integer id, String text) {

        this.id = id;
        this.text = text;
    }

    public static KingDeeTradeTypeEnum get(Integer code) {

        for (KingDeeTradeTypeEnum c : KingDeeTradeTypeEnum.values()) {
            if (c.id.toString().equals(code.toString())) {
                return c;
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return text;
    }
}
